(function(){
    let VSHADER_SOURCE=`
        void main(){
            gl_Position=vec4(0.,0.5,0.,1.);
            gl_PointSize=10.;

        }
    `;
    let FSHADER_SOURCE=`
        void main(){
            gl_FragColor=vec4(1.,1.,0.,1.);
        }
    `
    function main(){
        let canvas=document.getElementById('webgl-canvas');
       
        //获取webgl上下文
        let gl=getWebGLContext(canvas);
        if(!gl)return;

        if(!initShaders(gl,VSHADER_SOURCE,FSHADER_SOURCE)){
            console.log('Failed to initial shaders')
            return
        }



        //清除指定清除<canvas>的颜色
        gl.clearColor(0,0,0,1);
        //清除<canvas>的颜色
        gl.clear(gl.COLOR_BUFFER_BIT);

        //绘制一个点
        gl.drawArrays(gl.POINTS,0,1)

    }
    main();


})();